# Author:Zhang Yu
# 统计所有线程运行后的总时间
import threading
import time
class MyThread(threading.Thread):
    def __init__(self,n):
        super(MyThread,self).__init__()
        self.n = n

    def run(self):
        print("runing", self.n,threading.current_thread())
        time.sleep(2)

if __name__ == '__main__':
    t_objs = []
    start_time = time.time()
    for i in range(50):
        t1 = MyThread(i)
        t1.start()
        t_objs.append(t1)
    for t in t_objs:
        t.join()
    print(threading.active_count())
    end_time = time.time()
    print(threading.current_thread(),end_time-start_time)